#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	vector<int> times;
	int happinessLevel;
	for (int i = 0; i < 7; ++i)
	{
		int a, b;
		cin >> a >> b;
		times.push_back(a + b);
	}
	vector<int>::iterator max_it = max_element(times.begin(), times.end());
	int max_time = *max_it;
	if (max_time <= 8)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << (max_it - times.begin() + 1) << endl;
	}
	return 0;
}
